package com.liyiqing.secondhandmall.memberservice.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.liyiqing.commonservice.validator.ListValue;
import com.liyiqing.commonservice.validator.methodgroup.AddGroup;
import com.liyiqing.commonservice.validator.methodgroup.DeleteGroup;
import com.liyiqing.commonservice.validator.methodgroup.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 账号信息
 * 
 * @author LiYiQing
 * @email 1570865668@qq.com
 * @date 2022-02-18 22:47:22
 */
@Data
@TableName("member_user")
public class MemberUserEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 账号id
	 */
	@TableId
	@Null(message = "新增时不可指定账号id",groups = {AddGroup.class})
	@NotNull(message = "修改或删除时必须指定账号id",groups = {UpdateGroup.class, DeleteGroup.class})
	private Long id;
	/**
	 * 账号
	 */
	@NotBlank(message = "新增时必须填写账号",groups = {AddGroup.class})
	private String account;
	/**
	 * 用户名
	 */
	@NotBlank(message = "新增时必须填写用户名",groups = {AddGroup.class})
	private String username;
	/**
	 * 密码
	 */
	@NotBlank(message = "新增时必须填写密码",groups = {AddGroup.class})
	private String password;
	/**
	 * 手机号码
	 */
	@NotBlank(message = "新增时必须填写手机号",groups = {AddGroup.class})
	private String mobile;
	/**
	 * 微信号码
	 */
	private String wechat;
	/**
	 * QQ号码
	 */
	private String qq;
	/**
	 * 邮箱
	 */
	@Email(message = "邮箱格式有误",groups = {AddGroup.class,UpdateGroup.class})
	private String email;
	/**
	 * 头像
	 */
	@URL(message = "头像图片的url有误",groups = {AddGroup.class,UpdateGroup.class})
	private String header;
	/**
	 * 性别
	 */
	@ListValue(values = {1,2},message = "性别只能是:【1(男)】or【2(女)】")
	private Integer gender;
	/**
	 * 生日
	 */
	private String birth;
	/**
	 * 所在城市
	 */
	private String city;
	/**
	 * 账号身份：0普通用户；1系统管理员
	 */
	@ListValue(values = {0,1},message = "账号身份应为:【0(普通用户)】or【1(管理员)】")
	private Integer role;
	/**
	 * 注册时间
	 */
	private String createTime;
	/**
	 * 账号状态：0注销；1使用
	 */
	@TableLogic(value="1",delval="0")
	@ListValue(values = {0,1},message = "账号状态只能是:【1(使用)】or【0(注销)】")
	private Integer status;

}
